<?php
namespace  v1;

class CountClick extends \ResourceClass{

    public function post(array $req, array $post, &$result)
    {
        if (!array_key_exists('payload', $post)) {
            return 'require payload';
        }
        $data = base64_decode($post['payload']);
        @parse_str($data, $data);
        if (!isset($data['type'])) {
            return 'type不能为空';
        }
        if (!isset($req["user_id"])) {
            return "用户ID不能为空";
        }
        $count_click_log = new \Biz\CountClickLog();
        $res = $count_click_log->insertCountClickLog($data["type"],$req["user_id"]);
        if (is_object($res)) {
            $result = $res["id"];
        }
        $result = "提交失败!";
    }
}
